{include file="public/header" /}
</head>
<body>
<form class="layui-form layui-form-pane" action="" style="width: 80%;margin: 20px auto;">
    <input type="hidden" name="group_id" value="{$dataInfo.group_id|default=0}">
    <div class="layui-form-item">
        <label class="layui-form-label">角色名称</label>
        <div class="layui-input-block">
            <input type="text" name="group_name" required lay-verify="required"  placeholder="请输入角色名称" autocomplete="off" class="layui-input" value="{$dataInfo.group_name|default=''}">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">上级角色</label>
        <div class="layui-input-block">
            <select name="parent_id" >
                <option value="">请选择</option>
                {notempty name="groupList"}
                {volist name="groupList" id="tl"}
                <option value="{$tl.group_id}" {present name="dataInfo.parent_id"}{if condition="$tl['group_id'] == $dataInfo['parent_id']"}selected{/if}{/present}>{notempty name="$tl.level_name"}{$tl.level_name}&ensp;{/notempty}{$tl.group_name}</option>
                {/volist}
                {/notempty}
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="note" placeholder="请输入备注" class="layui-textarea">{$dataInfo.note|default=''}</textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
        </div>
    </div>
</form>
</body>
</html>

<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;
        form.render();
        //监听提交
        form.on('submit(formDemo)', function(data){
            post_sub("{:url('Admins/addGroup')}",data.field);
            return false;
        });
    });
</script>